﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoLoL.Logic.Repositories;
using AutoLoL.Entities;
using System.Collections.ObjectModel;

namespace AutoLoL.Logic.Factories
{
    // Is this a factory pattern? No idea =)
    public class SummonerSpellFactory : ISummonerSpellRepository
    {
        private static SummonerSpellFactory _instance;
        public static SummonerSpellFactory Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new SummonerSpellFactory();
                }

                return _instance;
            }
        }

        private ISummonerSpellRepository _repository;

        private SummonerSpellFactory()
        {
        }

        public void SetRepository(ISummonerSpellRepository repository)
        {
            _repository = repository;
        }

        public SummonerSpell GetByName(string summonerSpellName, IMasteryRepository masteryRepository)
        {
            return _repository.GetByName(summonerSpellName, masteryRepository);
        }

        public ReadOnlyCollection<SummonerSpell> GetAll(IMasteryRepository masteryRepository)
        {
            return _repository.GetAll(masteryRepository);
        }
    }
}
